package spring.cloud.tasks.common.curator;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.state.ConnectionStateListener;
import org.apache.zookeeper.data.Stat;

import java.util.List;

/**
 * <pre>
 * 如果你对该框架进行后续开发，麻烦深入研究本包内的方法。避免你在未来的开发测试部署过程中反复出现给自己挖坑填坑的情况。add by huihui
 * </pre>
 */
public interface Curator {
    public CuratorInfo getCuratorInfo();

    public CuratorFramework getCuratorFramework();

    public long getSessionId();

    public boolean isConnected();

    public void close();

    public void addConnectionStateListener(final ConnectionStateListener connectionStateListener);

    public void removeConnectionStateListener(final ConnectionStateListener connectionStateListener);

    /**
     * 共用一个连接会话,开启事务后进行事务操作
     */

    public TransactionalCurator getTransactionalCurator();
    //

    public boolean checkExists(final String path);


    public Stat getStat(String path);


    public Long getCtime(String path);

    public Long getMtime(String path);

    public String getData(final String path);


    public List<String> getChildren(final String path);


    public void ephemeralCreate(final String path, final String value);


    public void create(final String path);

    public void create(final String path, String value);

    public void update(final String path, final String value);

    public void merge(final String path, final String value);

    public void createIfAbsent(final String path, final String value);

    public void delete(final String path);
}
